﻿@model BuyWithoutLoseMoney.Core.Models.ProductType;
@{
    ViewData["Title"] = "编辑产品";
    Layout = null;
}
<!DOCTYPE html>
<html>
    <head>
        <meta name="viewport" content="width=device-width"/>
        <title>Edit</title>
        <link href="/layui/css/layui.css" rel="stylesheet"/>
    </head>
    <body>
    <div>
        <div class="layui-card">
            <div class="layui-card-header">修改产品分类</div>
            <div class="layui-card-body">
                <form class="layui-form">
                    <input type="hidden" name="Id" value="@Model.Id" />
                    <div class="layui-form-item">
                        <label class="layui-form-label">第一级产品分类</label>
                        <div class="layui-input-block">
                            <input type="text" name="FirstTypeName" value="@Model.FirstTypeName" required lay-verify="required" placeholder="请输入第一级产品分类" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">第二级产品分类</label>
                        <div class="layui-input-block">
                            <input type="text" name="SecondTypeName" value="@Model.SecondTypeName" required lay-verify="required" placeholder="请输入第二级产品分类" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">第三级产品分类</label>
                        <div class="layui-input-block">
                            <input type="text" name="ThirdTypeName" value="@Model.ThirdTypeName" required lay-verify="required" placeholder="请输入第三级产品分类" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit lay-filter="EditForm">修改</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <script src="/layui/layui.js"></script>
    <script>
        layui.use(["form", 'layer'], function () {
            var form = layui.form;
            var $ = layui.$;
            var layer = layui.layer;
            //修改
            form.on('submit(EditForm)', function (data) {
                $.post("/admin/proudctcategory/edit", data.field, function (res) {
                    if (res.isSuccess) {
                        layer.msg(res.msg, function () {
                            parent.window.location.href = "/admin/proudctcategory/index";
                        });
                    } else {
                        layer.msg(res.msg);
                    }
                });
                return false;
            });
        })
    </script>
    </body>
</html>
